{include file="news/header.tpl"}
<link href="../../static/bootstrap/css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
{literal}
<style type="text/css">
.form_date{width:80px;border:1px #ccc solid;}
</style>
{/literal}
<!-- 头部// -->
{include file="order/top.tpl"}



	<!-- start: Content -->
			<div id="content" class="span12">
			
						
			<div class="row-fluid">


<div class="box span12"><!-- Default panel contents -->



<div class="box-content">
<form name="news" action="/member/csearch" method="post"
	class="form-inline">类型 <select name="type" class="form-control" style="width:100px;">
	<option value="mobile_phone">手机</option>
	<option value="real_name" selected>真实姓名</option>

</select>
<input type="hidden" name="mb" value="morder.tpl">

<input type="text" value="" name="value"
	class="control" style="width:120px;">
<button type="submit" class="btn btn-primary"><i class="icon-search"></i></button>
</form>
<form name="news" class="form-inline" action="/order/export/" method="post"
	class="form-inline"> 起止日期:<input class="form_date" name="starttime" value="2014.01.01"  readonly> - <input name="endtime" class="form_date" value="2014.04.02"  readonly> 资金流向:<input type="checkbox"
	name="payment" value="0">收入 <input type="checkbox" name="payment"
	value="1">支出  <span
	class=""></span> 
	<input type="hidden" name="uid" value="{$userinfo.uid}">
	<button type="submit" class="btn btn-info btn-sm">
  <span class="icon-upload-alt">导出</span> 
</button>


   

	 最近一个月  收入: <span class="amount_pay_in">{$coupons.income}</span> 支出:<span class="amount_pay_out">{$coupons.spend}</span>
   用户 {$userinfo.real_name}  积分{$userinfo.coupons}  余额 {$userinfo.money}
</form>


积分<input type="text" id="coupons" value="0.00">
   备注<input type="text" id="remark" name="remark" value="政策返利">        
           验证码<input type="text" name="codeimg" id="codeimg"  style="width:80px;marign-right:10px;">
           <img src="/anonymous/validate" id="codeimgg" width="80px;" height="35px;" style="margin-left:20px;" onclick="changeImg()">
            <input type="hidden" id="uid" name="uid" value="{$uid}"><button class="btn btn-primary" onclick="charge()">充值</button>

<table class="table table-striped  table-hover">
	<tr>


		<th width="6%">流水号</th>
		<th width="15%">日期</th>
		<th width="15%">订单号</th>
		<th width="10%">名称|备注</th>
		<th width="10%">收入</th>
		<th width="10%">支出</th>
		<th width="10%">渠道</th>
		<th width="10%">状态</th>

	</tr>




	{foreach from=$mx item=l }
	<tr>
		<td>{$l.id}</td>
		<td>{$l.date|date_format:"%Y-%m-%d %H:%M:%S"}</td>
		<td>{$l.orderno}</td>
		<td>{$l.remark}</td>
		<td>{if $l.payment==0}<span class="amount_pay_in">+{$l.coupons}</span></td>
		<td></td>
		{else}
		</td>
		<td><span class="amount_pay_out">{$l.coupons}</td>
		{/if}
		<td>{$l.chargetypes}</td>
<td class=left width="8%">{if $l.status=="等待审核"}<span class="label label-warning">{$l.status}</span>{else if $l.status=="关闭"}<span class="label label-default">{$l.status}</span>{else}<span class="label label-success">{$l.status}</span>{/if}</td>

	</tr>
	{/foreach}
</table>
<div class="pagination pagination-centered">
<ul id="pager"></ul></div>

</div>




</div>


{literal}
<script type="text/javascript" src="/static/bootstrap/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
<script type="text/javascript" src="/static/bootstrap/js/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
 <script type='text/javascript'>
 function charge(){
var remark=$("#remark").val();
		var num=$("#coupons").val();
		var code=$("#codeimg").val();
		if(num<1){
	alert("积分必须大于0");
	return false;
	     }
	var uid=$("#uid").val();
	    
	   $.post("/order/addcoupons",{coupons:num,remark:remark,codeimg:code,uid:uid},function(data){

	alert(data.message);
location.reload();
	//changeImg();
		   },"json")
		
		}

	function changeImg(){
	    document.getElementById("codeimgg").src="/anonymous/validate/?"+Math.random();

	}
 
 $('.form_date').datetimepicker({
     language:  'zh-CN',
     format:'yyyy.mm.dd',
     weekStart: 1,
     todayBtn:  0,
		autoclose: 1,
		todayHighlight: 1,
		startView: 2,
		minView: 2,
		forceParse: 0
 });
var options = {
currentPage: {/literal}{$num.current}{literal},
totalPages: {/literal}{$num.page}{literal},
numberOfPages:5,
bootstrapMajorVersion:3,
pageUrl: function(type, page, current){
    return '/order/charge/?uid={/literal}{$uid}{literal}&p='+page;
}
}
$('#pager').bootstrapPaginator(options);
</script>
{/literal}
{include file="news/footer.tpl"}
